package bishi.day21_5_18;

import java.util.*;

/**
 * 洗  牌
 * @author 是阿秋啊
 * @date 2022/05/18 16:38
 **/
public class shuffle_the_cards {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = sc.nextInt();
        while(count > 0) {
            count--;
            int n = sc.nextInt();
            int k = sc.nextInt();
            int[] ret = new int[2 * n];
            int[] tmp = new int[n];
            for(int i = 0; i < 2 * n; i++) {
                int num = sc.nextInt();
                if(i < n) tmp[i] = num;
                ret[i] = num;
            }
            while(k > 0) {
                k--;
                int pre = 0;
                for(int i = 1; i < 2* n; i += 2) {
                    ret[i] = ret[n + pre];
                    ret[i - 1] = tmp[pre++];
                }
                tmp = Arrays.copyOf(ret,n);
            }
            for(int i = 0; i < 2 * n; i++) {
                if(i == 2 * n - 1) {
                    System.out.println(ret[i]);
                }else {
                    System.out.print(ret[i]+" ");
                }
            }
        }
    }
}